#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

typedef struct ListNode {
	int val;
	struct ListNode* next;
}ListNode;


struct ListNode* middleNode(struct ListNode* head) {
	ListNode* cur1 = head;
	int count1 = 0;
	while (cur1)
	{
		cur1 = cur1->next;
		count1++;
	}
	ListNode* cur2 = head;
	int count2 = 0;
	count1 = count1 / 2 ;
	while (count1 != count2)
	{
		cur2 = cur2->next;
		count2++;
	}
	return cur2;
}

//
//int main()
//{
//
//	return 0;
//}